import Vue from 'vue'
import App from './app.vue'
import router from './router'
import store from './store'
import $ from 'jquery'


import controlRouter from '../api/addRouter.js'

//引入全局bootstrap样式
//css bootstrap
import 'bootstrap/dist/css/bootstrap.min.css';
//js bootstrap
import 'bootstrap/dist/js/bootstrap.min.js';
import 'bootstrap/dist/js/bootstrap.bundle.min.js';
import { Validate } from '../api/validate.js' //自己写的校验工具

//校验组建 vee-validate
import VeeValidate , { Validator } from 'vee-validate';
import zh_cn from 'vee-validate/dist/locale/zh_CN.js';
//vee-validate 配置项
const config = {
  aria: true,
  classNames: {},
  classes: false,
  delay: 0,
  dictionary: {
    'zh_CN': { messages : zh_cn }
  },
  errorBagName: 'errors', // change if property conflicts
  events: 'input|blur', //input|blur
  fieldsBagName: 'fields',
  i18n: null, // the vue-i18n plugin instance
  i18nRootKey: 'validations', // the nested key under which the validation messages will be located
  inject: true,
  locale: 'zh_CN', //  en change to zh_CN
  validity: false,
  useConstraintAttrs: true
};
//安装veevalidate插件
Vue.use(VeeValidate, config);
Validator.localize('zh_CN', zh_cn);


// 自定义校验规则
import { 
    illegalChar ,
    emptyInStr
} from "../api/veeValidateRules/rules_veevalidate.js";
Validator.extend("illegalchar" , illegalChar ); //非法字符检查
Validator.extend("empInStr" , emptyInStr ); //内容是空白字符

//symbol icon
import "./icon/symbol.js";

import animated from 'animate.css';
Vue.use(animated);
Vue.config.productionTip = false
Vue.prototype.$ = $;
Vue.use(controlRouter);
Vue.use( new Validate() );

import { HttpError } from "../api/error.js";
//错误处理全局对象
Vue.use( new HttpError() );

//笔记本对象
import { NoteBook } from "../api/noteBook.js";
//加载笔记本对象
Vue.use( new NoteBook() );

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
